<template>
	<view class="main">
		<block>
			<view class="active_tit">
				<view class="tit">
					财务报表--资产负债表
				</view> 
			</view>
			<view class="active_tit">
				<view class="tit">
					资产
				</view> 
			</view>
			<!-- input -->
			<ActiveForm required  ref='A030101' class="QA">
				<view class="active_label QA" >
					截止当前时点现金和银行存款共有多少元？：
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030101.endSum" placeholder="" />
					
				</view>
			</ActiveForm>
			<ActiveForm required  ref='A030102' class="QA">
				<view class="active_label QA">
					截止当前时点应收账款有多少元？
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030102.endSum" placeholder="" />
					
				</view>
			</ActiveForm>
			<ActiveForm required  ref='A030103' class="QA">
				<view class="active_label QA">
					截止当前时点预付账款有多少元？
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030103.endSum" placeholder="" />
					
				</view>
			</ActiveForm>
			<ActiveForm required  ref='A030104' class="QA">
				<view class="active_label QA">
					截止当前时点存货货值多少元？
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030104.endSum" placeholder="" />
					
				</view>
			</ActiveForm>
			
			<ActiveForm required  ref='A030106' class="QA">
				<view class="active_label QA">
					经营性房地产（元）：
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030106.endSum" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm required  ref='A030107' class="QA">
				<view class="active_label QA">
					截止当前时点机器设备价值多少元？
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030107.endSum" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm required  ref='A030108' class="QA">
				<view class="active_label QA">
					截止当前时点经营性车辆价值多少元？
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030108.endSum" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm   ref='A030105' class="QA">
				<view class="active_label QA">
					固定资产（元）：
				</view>
				<view class="active_input">
					<mInput :disabled="true" maxlength="16" type="number" v-model="form.A03.A030105.endSum" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm required  ref='A030109' class="QA">
				<view class="active_label QA">
					截止当前时点其他经营性资产价值多少元？
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030109.endSum" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm required  ref='' class="QA">
				<view class="active_label QA">
					资产总计（元）：
				</view>
				<view class="active_input">
					<mInput disabled maxlength="16" type="number" v-model="zichan" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm required  ref='A030110' class="QA">
				<view class="active_label QA">
					截止当前时点表外资产（如有）价值多少元？
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030110.endSum" placeholder="" />
				</view>
			</ActiveForm>
			
			
			<view class="active_tit">
				<view class="tit2">
					负债
				</view> 
			</view>
			<ActiveForm   ref='A030201' class="QA">
				<view class="active_label QA">
					银行借款（元）：
				</view>
				<view class="active_input">
					<mInput maxlength="16" disabled type="number" v-model="form.A03.A030201.endSum" placeholder="" />
				</view>
			</ActiveForm>
			
			<ActiveForm   ref='A030202' class="QA">
				<view class="active_label QA">
					其他负债业务（小贷公司等其他非银金融机构）：
				</view>
				<view class="active_input">
					<mInput maxlength="16" disabled type="number" v-model="form.A03.A030202.endSum" placeholder="" />
					
				</view>
			</ActiveForm>
			
			<ActiveForm   ref='A030203' class="QA">
				<view class="active_label QA">
					信用卡（元）：
				</view>
				<view class="active_input">
					<mInput maxlength="16" disabled type="number" v-model="form.A03.A030203.endSum" placeholder="" />
					
				</view>
			</ActiveForm>
			
			<ActiveForm required  ref='A030204' class="QA">
				<view class="active_label QA">
					截止当前时点预收账款有多少元？<!-- //私人借款 -->
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030204.endSum" placeholder="" />
				</view>
			</ActiveForm>
			
			
			
			<ActiveForm required  ref='A030205' class="QA">
				<view class="active_label QA">
					截止当前时点应付账款有多少元？
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030205.endSum" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm required  ref='A030206' class="QA">
				<view class="active_label QA">
					截止当前时点长期负债及其他负债共有多少元？
				</view>
				<view class="active_input">
					<mInput maxlength="16" type="number" v-model="form.A03.A030206.endSum" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm   ref='' class="QA">
				<view class="active_label QA">
					负债合计（元）：
				</view>
				<view class="active_input">
					<mInput disabled maxlength="16" type="number" v-model="fuzhai" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm   ref='' class="QA">
				<view class="active_label QA">
					权益合计（元）：
				</view>
				<view class="active_input">
					<mInput negative disabled maxlength="16"  v-model="quanyi" placeholder="" />
				</view>
			</ActiveForm>
			<!-- <ActiveForm required  ref='' class="QA">
				<view class="active_label QA">
					资产负债率：
				</view>
				<view class="active_input">
					<mInput negative disabled maxlength="16"  v-model="quanyi" placeholder="" />
				</view>
			</ActiveForm> -->
			
		
			
		</block>
		
		<block>
			<view class="active_tit">
				<view class="tit">
					财务报表--损益表
				</view> 
			</view>
			<!-- input -->
			<ActiveForm   ref='A040024' style="width: 50%;">
				<view class="active_label">
					近12个月开票营业额（元）：
				</view>
				<view class="active_input">
					<mInput negative disabled maxlength="16" type="number" v-model="form.A04.A040024.endSum" placeholder="" />
					
				</view>
			</ActiveForm>
			<ActiveForm   ref='A040001' style="width: 50%;">
				<view class="active_label">
					近12个月未开票营业额（元）：
				</view>
				<view class="active_input">
					<mInput negative disabled maxlength="16" type="number" v-model="form.A04.A040001.endSum" placeholder="" />
					
				</view>
			</ActiveForm>
			<ActiveForm   ref='A040002' style="width: 50%;">
				<view class="active_label">
					近12个月营业成本（可变成本）（元）：
				</view>
				<view class="active_input">
					<mInput negative disabled maxlength="16" type="number" v-model="form.A04.A040002.endSum" placeholder="" />
					
				</view>
			</ActiveForm>
			<ActiveForm   ref='A040003' style="width: 50%;">
				<view class="active_label">
					近12个月营业费用（固定成本）（元）：
				</view>
				<view class="active_input">
					<mInput negative disabled maxlength="16" type="number" v-model="form.A04.A040003.endSum" placeholder="" />
					
				</view>
			</ActiveForm>
		
			<ActiveForm   ref='A040016' style="width: 50%;">
				<view class="active_label">
					近12个月净利润（元）：
				</view>
				<view class="active_input">
					<mInput negative disabled maxlength="16" type="number" v-model="form.A04.A040016.endSum" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm required  ref='A040017' style="width: 50%;">
				<view class="active_label">
					近12个月其他支出（元）：
				</view>
				<view class="active_input">
					<mInput negative  maxlength="16" type="number" v-model="form.A04.A040017.endSum" placeholder="" />
				</view>
			</ActiveForm>
			
			
			<ActiveForm required  ref='A040021' style="width: 50%;">
				<view class="active_label">
					近12个月其他收入（元）：
				</view>
				<view class="active_input">
					<mInput negative  maxlength="16" type="number" v-model="form.A04.A040021.endSum" placeholder="" />
				</view>
			</ActiveForm>
			<ActiveForm   ref='A040022' style="width: 50%;">
				<view class="active_label">
					月可支配收入（元）：
				</view>
				<view class="active_input">
					<mInput negative disabled maxlength="16" type="number" v-model="form.A04.A040022.endSum" placeholder="" />
				</view>
			</ActiveForm>
			
			
			
		</block>
		
		
	</view>
</template>

<script>
	export default{
		data(){
			return{
				zichan:'',
				fuzhai:'',
				quanyi:'',
				form:{
					name:'',
					name2:'',
					beginSum:'',
					ndSum:'',
					A03:{
						A030101:{
							beginSum:'',
							endSum:''
						},
						A030102:{
							beginSum:'',
							endSum:''
						},
						A030103:{
							beginSum:'',
							endSum:''
						},
						A030104:{
							beginSum:'',
							endSum:''
						},
						A030105:{
							beginSum:'',
							endSum:''
						},
						A030106:{
							beginSum:'',
							endSum:''
						},
						A030107:{
							beginSum:'',
							endSum:''
						},
						A030108:{
							beginSum:'',
							endSum:''
						},
						A030109:{
							beginSum:'',
							endSum:''
						},
						A030110:{
							beginSum:'',
							endSum:''
						},
						A030201:{
							beginSum:'',
							endSum:''
						},
						A030202:{
							beginSum:'',
							endSum:''
						},
						A030203:{
							beginSum:'',
							endSum:''
						},
						A030204:{
							beginSum:'',
							endSum:''
						},
						A030205:{
							beginSum:'',
							endSum:''
						},
						A030206:{
							beginSum:'',
							endSum:''
						},
						A030111:{
							beginSum:'',
							endSum:''
						},
						A030207:{
							beginSum:'',
							endSum:''
						},
						A030208:{
							beginSum:'',
							endSum:''
						},
					},
					A04:{
						A040001:{
							beginSum:'',
							endSum:''
						},
						A040002:{
							beginSum:'',
							endSum:''
						},
						A040003:{
							beginSum:'',
							endSum:''
						},
						A040004:{
							beginSum:'',
							endSum:''
						},
						A040005:{
							beginSum:'',
							endSum:''
						},
						A040006:{
							beginSum:'',
							endSum:''
						},
						A040007:{
							beginSum:'',
							endSum:''
						},
						A040008:{
							beginSum:'',
							endSum:''
						},
						A040009:{
							beginSum:'',
							endSum:''
						},
						A040010:{
							beginSum:'',
							endSum:''
						},
						A040011:{
							beginSum:'',
							endSum:''
						},
						A040012:{
							beginSum:'',
							endSum:''
						},
						A040013:{
							beginSum:'',
							endSum:''
						},
						A040014:{
							beginSum:'',
							endSum:''
						},
						A040015:{
							beginSum:'',
							endSum:''
						},
						A040016:{
							beginSum:'',
							endSum:''
						},
						A040017:{
							beginSum:'',
							endSum:''
						},
						A040018:{
							beginSum:'',
							endSum:''
						},
						A040019:{
							beginSum:'',
							endSum:''
						},
						A040020:{
							beginSum:'',
							endSum:''
						},
						A040021:{
							beginSum:'',
							endSum:''
						},
						A040022:{
							beginSum:'',
							endSum:''
						},
						A040023:{
							beginSum:'',
							endSum:''
						},
						A040024:{
							beginSum:'',
							endSum:''
						}

					}
				
				}
			}
		},
		props:{
			changeFlag: {

			},
		},
		watch:{
			changeFlag:{
				handler:function(res){
					//console.log(res)
					setTimeout(()=>{
						this.sunyi()
					},300)
					setTimeout(()=>{
						this.sunyi()
					},600)
				   
				},
				deep:true
			},
			form:{
				handler:function(res){
				//console.warn('简易报表数据变化',res)
				
				getApp().globalData.stdOffsurCommonFinancial = Object.assign(getApp().globalData.stdOffsurCommonFinancial,res) 
				this.zichanHj()
				this.fuzhaiHj()
				this.form.A03.A030105.endSum=Number(this.form.A03.A030106.endSum)+Number(this.form.A03.A030107.endSum)+Number(this.form.A03.A030108.endSum)
				//this.sunyi()
				},
				deep:true
			}
		},
		mounted() {
			//获取返显数据
			setTimeout(()=>{	
				//数据反显
				this.form = getApp().globalData.stdOffsurCommonFinancial
			},getApp().globalData.timeout)
		},
		methods:{
			zichanHj(){
				let num = 0
				let arr=["A030101","A030102","A030103","A030104","A030105","A030109",]
				for(let i=0;i<arr.length;i++){
					num+=Number(this.form.A03[arr[i]].endSum)*100
				}
				this.zichan =num/100
				
				getApp().globalData.stdOffsurCommonFinancial.A03.A030111.endSum = this.zichan
			},
			fuzhaiHj(){
				let num = 0
				let arr=["A030201","A030202","A030203","A030204","A030205","A030206"]
				for(let i=0;i<arr.length;i++){
					num+=Number(this.form.A03[arr[i]].endSum)*100
				}
				this.fuzhai = num/100
				this.quanyi = (this.zichan*100-this.fuzhai*100)/100
				
				getApp().globalData.stdOffsurCommonFinancial.A03.A030207.endSum = this.fuzhai
				getApp().globalData.stdOffsurCommonFinancial.A03.A030208.endSum = this.quanyi
			},
			sunyi(){
				
				let industry={}
				if(getApp().globalData.stdOffsurEntBasic.industry==1||getApp().globalData.stdOffsurEntBasic.industry==6){
					 industry = getApp().globalData.stdOffsurWholesale
				}else if(getApp().globalData.stdOffsurEntBasic.industry==2){
					 industry = getApp().globalData.stdOffsurProcuct
				}else if(getApp().globalData.stdOffsurEntBasic.industry==3){
					 industry = getApp().globalData.stdOffsurService
				}else if(getApp().globalData.stdOffsurEntBasic.industry==4){
					 industry = getApp().globalData.stdOffsurTraffic
				}else if(getApp().globalData.stdOffsurEntBasic.industry==5){
					 industry = getApp().globalData.stdOffsurConstruction
					 industry.invoiceRatio = 100
				}
				if(getApp().globalData.stdOffsurEntBasic.industry==5){
					//console.log(getApp().globalData.stdOffsurConstructionMargin)
					this.form.A04.A040024.endSum =(Number(getApp().globalData.stdOffsurConstructionMargin[0].invoice12month)*100+Number(getApp().globalData.stdOffsurConstructionMargin[1].invoice12month)*100)/100  
				    this.form.A04.A040001.endSum = (Number(industry.turnover12month)*100 - this.form.A04.A040024.endSum*100)/100
				}else{
					//近12个月月均开票营业额 = 近12月营业额/工程额*开票比例
					this.form.A04.A040024.endSum = Number(industry.turnover12month)*Number(industry.invoiceRatio)/100
				    //近12个月月均未开票营业额 = 近12月营业额*（1-开票比例）
				    
				    this.form.A04.A040001.endSum = Number(industry.turnover12month)*(100-Number(industry.invoiceRatio))/100
				}
				
				
				
				
				//近12个月月均营业成本（可变成本）=近12月营业额*（1-综合毛利率）
				this.form.A04.A040002.endSum =  Number(industry.turnover12month)*(100-Number(industry.marginRate))/100 
				//近12个月月均营业费用（固定成本）=除其他以外费用合计
				this.form.A04.A040003.endSum = 0
				let fyArr = getApp().globalData.stdOffsurLoanCost
				
				for(let i=0;i<fyArr.length;i++){
					this.form.A04.A040003.endSum += Number(fyArr[i].cost12months)
				}
				//近12个月净利润 = 近12月营业额-可变成本-固定成本
				this.form.A04.A040016.endSum = (Number(industry.turnover12month)*100 - Number(this.form.A04.A040002.endSum)*100-Number(this.form.A04.A040003.endSum)*100)/100
				
				//近12个月其他收入 =  
				//this.form.A04.A040021.endSum = getApp().globalData.stdOffsurLoanBasic.outIncome
				//月可支配收入 = 净利润-其他支出+其他收入 
				this.form.A04.A040022.endSum = ((Number(this.form.A04.A040016.endSum)-Number(this.form.A04.A040017.endSum)+Number(this.form.A04.A040021.endSum))/12).toFixed(2)
				//近12个月其他支出=
				//this.form.A04.A040017.endSum =Number(getApp().globalData.stdOffsurLoanBasic.otherOutInvestment) 
			}
		}
	}
</script>

<style lang="scss">
	.QA{
		width: 100% !important;
		flex-direction: column;
		align-items: flex-start;
	}
</style>
